home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CUCD / Programming / DiceSource / src / editors / AME / Rexx / vgoto.ame < prev    next >
Encoding:
Text File  |  1994-02-01  |  1.7 KB  |  89 lines

  1. /* $VER: VGoto 37.1 (21.2.93) */
  2. /* This program brings up a Goto Requester for AME */
  3.  
  4. if show("l", "rexxarplib.library") = 0 then do
  5.    check = addlib('rexxsupport.library', 0, -30, 0)
  6.    check = addlib('rexxarplib.library',  0, -30, 0)
  7. end
  8.  
  9. options results
  10.  
  11. /*
  12. *   The following sequence determines both AME's screen and port name,
  13. *   and also gets the number screen rows and columns.
  14. */
  15.  
  16. ameport = address()
  17. cols = ScreenCols(ameport)
  18. if cols == -1 then do
  19.    amescreen = ""
  20.    cols = ScreenCols()
  21.    rows = ScreenRows()
  22. end
  23. else do
  24.    amescreen = ameport
  25.    rows = ScreenRows(amescreen)
  26. end
  27. /*
  28.  *   Set up a host. This time, send all messages to our own port.
  29.  */
  30.  
  31. address AREXX "'x = CreateHost(AMESEARCH, MFLAGSPORT, "amescreen")'"
  32. /*
  33.  *   Wait until it is ready.
  34.  */
  35. do i = 1
  36.    if showlist('p', AMESEARCH) ~= 0 then leave
  37.    call delay 30
  38. end
  39.  
  40. /*
  41.  *   Open the window
  42.  */
  43.  
  44. idcmp = 'CLOSEWINDOW+GADGETUP'
  45. flags = 'WINDOWCLOSE+WINDOWDRAG+WINDOWDEPTH+ACTIVATE'
  46.  
  47. call OpenWindow(AMESEARCH, (cols - 640)/2, rows - 190, 120, 60, idcmp,   ,
  48.                 flags, "Goto...")
  49.  
  50. /*
  51.  *   Open the port that messages will come to
  52.  */
  53. mp = openport(MFLAGSPORT)
  54.  
  55.  
  56. /*
  57.  *   Add the gadgets
  58.  */
  59.  
  60. call AddGadget(AMESEARCH, 36,   28, 2, "", "%d%1%g", 48, RIDGEBORDER)
  61.  
  62. /*
  63.  *   Main event loop
  64.  */
  65. quitflag  = 0
  66.  
  67. do forever
  68.    if quitflag = 1 then leave
  69.    t = waitpkt(MFLAGSPORT)
  70.    do forever
  71.       p = getpkt(MFLAGSPORT)
  72.       if c2d(p) = 0 then leave
  73.       cmd = getarg(p)
  74.       if cmd = 2 then findstring = getarg(p,1)
  75.       t = reply(p, 0)
  76.     
  77.       if cmd = "CLOSEWINDOW" then do
  78.          call CloseWindow(AMESEARCH)
  79.          quitflag = 1
  80.       end
  81.       else if cmd = "2" then do
  82.          call CloseWindow(AMESEARCH)
  83.          quitflag = 1
  84.     'gotoline' findstring
  85.       end
  86.    end
  87. end
  88.  
  89. exit